/**
 * 
 */
package org.restapp.resource;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.restapp.core.XUser;
import org.restapp.service.XUserService;
import org.restapp.service.impl.XUserServiceImpl;

import com.codahale.metrics.annotation.Timed;

/**
 * @author asudar
 * 
 */
@Path("/user")
@Produces(value = MediaType.APPLICATION_JSON)
public class UserResource {

	@Path("/create")
	@GET
	@Timed
	public String create() {
		XUser user = new XUser("aaa", "aaa", 12, "India");
		XUser user1 = new XUser("bbb", "bbb", 13, "China");
		XUser user2 = new XUser("ccc", "ccc", 14, "UK");
		XUserService xUserService = new XUserServiceImpl();
		xUserService.create(user);
		xUserService.create(user1);
		xUserService.create(user2);

		return "Users added to List !";
	}

	@Path("/list")
	@GET
	@Timed
	public String getAll() {
		XUserService xUserService = new XUserServiceImpl();
		return xUserService.getAll().toString();
	}

}
